module ziyi{
    export class Utils{
        public static createBitmapByName(name:string, type:string = 'png') {
            let result = new egret.Bitmap();
            let texture:egret.Texture = RES.getRes(name + "_" + type);
            result.texture = texture;
            return result;
        }
        public static createMovieClipByName(name:string):egret.MovieClip {
            let data = RES.getRes(name + "_json");
            let texture:egret.Texture = RES.getRes(name + "_png");
            //创建动画工厂
            let mcf:egret.MovieClipDataFactory = new egret.MovieClipDataFactory(data, texture);
            let mc=new egret.MovieClip(mcf.generateMovieClipData(name));
            mc.gotoAndPlay(1,-1);
            mc.anchorOffsetX=mc.width/2;
            mc.anchorOffsetY=mc.height/2;
            mc.scaleX=1.2;
            mc.scaleY=1.2;
            return mc;
        };
    }
}